home *** CD-ROM | disk | FTP | other *** search
- Path: jetty.telerate.com!jjoshua
- From: jjoshua@barcelona.tts.telerate.com (Jonathan Joshua)
- Newsgroups: comp.lang.c++
- Subject: sizeof inside of enum question
- Date: 26 Feb 1996 20:42:03 GMT
- Organization: Dow Jones Telerate
- Message-ID: <4gt5ur$qi1@jetty.telerate.com>
- NNTP-Posting-Host: barcelona.tts.telerate.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- I'm having a problem using the sizeof operator inside of an enum. For example:
-
- char t [13];
- ...
- enum { s = sizeof (t) }; <-- Compiler Error
-
- However, the following works:
-
- enum { s = sizeof (char) };
-
- The reason for trying to do this is that I am using a design tool that creates
- code for me. In the above example, I don't know what the size of "t" will
- always be.
-
- What's the difference? How can I work around this problem?
-
- Thanks,
- JOn.
-
- ==============================================================================
- Jonathan Joshua jjoshua@tts.telerate.com
- Principal Software Engineer
- Dow Jones Telerate
-